#include "Condition.hpp"
#include "Mutex.hpp"

#include <cstddef>
#include <iostream>
#include <pthread.h>
using std::cout;
using std::endl;



namespace tp{

Condition::Condition()
{
    pthread_cond_init(&_cond,NULL);    
}
Condition::~Condition(){
    pthread_cond_destroy(&_cond);
}
    
void Condition::wait(Mutex & mutex){
    pthread_cond_wait(&_cond,mutex.get_mutex_ptr());
}
    
void Condition::notify_one(){
    pthread_cond_signal(&_cond);
}
void Condition::notify_all(){
    pthread_cond_broadcast(&_cond);
}


}

